<?php
/**
 * 用户模型
 * @author GL
 * @date 2018.8.23
 */

namespace App\Model\Crm;

use App\model\BaseModel;
use DB;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\Response;

class UserModel extends BaseModel{

    const USER = 'user';

    //获取用户信息
    public static function getUserInfo($where, $field = '*')
    {
        return DB::table(self::USER)->where($where)->select($field)->first();
    }

    //更新用户信息
    public static function updateUserInfo($where = [], $data = [])
    {
        return DB::table(self::USER)->where($where)->update($data);
    }


    //删除session用户信息
    public static function forgetLogin() {
        self::forgetUser();
    }


    //删除登录信息
    public static function forgetUser() {
        session()->forget('user_id');
        session()->forget('userInfo');
    }

    //存储cookie信息
    public static function pushCookie($data = [])
    {

    }
}